/**
 * FreeZzaphPluginPreferences.java
 * 
 * FreeZzaph is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * FreeZzaph is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file COPYING.
 */
package freezzaph.plugins;

import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;

/**
 * <code>Preferences</code> capsule, used to provide
 * plugins with a way to store and retrieve settings. See
 * the methods given on the <code>Preferences</code>
 * class for documentation.
 * 
 * @author FreeZzaph
 * @see Preferences
 */
public final class FreeZzaphPluginPreferences {
	
	private Preferences prefs;
	
	public FreeZzaphPluginPreferences(Preferences prefs) {
		this.prefs = prefs;
	}
	
	public void clear() throws BackingStoreException {
		prefs.clear();
	}
	
	public String get(String key, String def) {
		return prefs.get(key, def);
	}
	
	public boolean getBoolean(String key, boolean def) {
		return prefs.getBoolean(key, def);
	}
	
	public byte[] getByteArray(String key, byte[] def) {
		return prefs.getByteArray(key, def);
	}
	
	public double getDouble(String key, double def) {
		return prefs.getDouble(key, def);
	}
	
	public float getFloat(String key, float def) {
		return prefs.getFloat(key, def);
	}
	
	public int getInt(String key, int def) {
		return prefs.getInt(key, def);
	}
	
	public long getLong(String key, long def) {
		return prefs.getLong(key, def);
	}
	
	public String[] keys() throws BackingStoreException {
		return prefs.keys();
	}
	
	public void put(String key, String value) {
		prefs.put(key, value);
	}
	
	public void putBoolean(String key, boolean value) {
		prefs.putBoolean(key, value);
	}
	
	public void putByteArray(String key, byte[] value) {
		prefs.putByteArray(key, value);
	}
	
	public void putDouble(String key, double value) {
		prefs.putDouble(key, value);
	}
	
	public void putFloat(String key, float value) {
		prefs.putFloat(key, value);
	}
	
	public void putInt(String key, int value) {
		prefs.putInt(key, value);
	}
	
	public void putLong(String key, long value) {
		prefs.putLong(key, value);
	}
	
	public void remove(String key) {
		prefs.remove(key);
	}

}
